import { mapGetters, mapActions } from "vuex";
import _ from "lodash";
import { websocketsend } from "@/assets/js/websocket";
import CheckIcon from "vux/src/components/check-icon/index.vue";

import { timeFormat } from "@/assets/js/dom";
import template from "./lhcTemplate";
const { render, staticRenderFns } = template;

export default {
  render,
  staticRenderFns,
  props: ["oddsData", "betMoneyList", "lDragonData"],
  data() {
    return {
      showBetInfoBox: false,
      showBetOpBox: false,
      showBetInfoList: false,
      methodsArr: [], //玩法列表
      chekedMethod: 0, //选中的玩法下标
      playMethod: {}, //选中的玩法
      showSelect: false, //是否有下拉列表
      checkedOddIndex: -1, //选中赔率下标
      checkedOdd: [], //选中的赔率
      zhuDanOdd: [], //注单arr
      zhuDanOddLen: 0, //注单实际注数
      checkedOddLen: [], //选中的赔率长度
      oddsWay: [], //投注数据
      moneyArr: [], //金额数组
      totalMoney: 0, //选中总金额
      totalMoney1: 0, //注单总金额
      checkedMoneyIdx: 0, //选中筹码下标
      checkedMoney: 0, //选中金额
      yqMoney: 0, //预期盈利
      maxyqMoney: 0, //预期最大盈利
      minyqMoney: 0, //预期最小盈利
      manyBei: 1,
      manyQi: 1,
      totalZhMoney: 0,
      showZhBox: false, //显示追号
      showZhList: false, //显示追号list
      zhuiHaoList: [],
      zhBetData: [],
      checkedName: "",
      winStop: true, //是否追停
      showOddsTip: false,
      activeSelect: "特A",
      wanfOdds: [
        {
          name: "特码",
          set: ["特A", "特B"],
          panel: [],
        },
        {
          name: "正码",
          set: ["正A", "正B"],
          panel: [],
        },
        {
          name: "正特",
          set: ["正1特", "正2特", "正3特", "正4特", "正5特", "正6特"],
          panel: [],
        },
        {
          name: "连码",
          set: ["三中二", "三全中", "二全中", "二中特", "特串"],
          panel: [],
        },
        {
          name: "半波",
          panel: [],
        },
        {
          name: "尾数",
          panel: [],
        },
        {
          name: "一肖",
          panel: [],
        },
        {
          name: "特肖",
          panel: [],
        },
        {
          name: "连肖",
          set: [
            "二肖连中",
            "三肖连中",
            "四肖连中",
            "二肖连不中",
            "三肖连不中",
            "四肖连不中",
          ],
          panel: [],
        },
        {
          name: "连尾",
          set: [
            "二尾连中",
            "三尾连中",
            "四尾连中",
            "二尾连不中",
            "三尾连不中",
            "四尾连不中",
          ],
          panel: [],
        },
        {
          name: "不中",
          set: ["五不中", "六不中", "七不中", "八不中", "九不中", "十不中"],
          panel: [],
        },
        {
          name: "正码1-6",
          panel: [],
        },
        {
          name: "正1-6龙虎",
          panel: [],
        },
      ],
      realCkedOdd: [],
      lmTitleArr: [],
      chekedMethod1: 0,
      token: localStorage.getItem("token"),
    };
  },

  created() {},
  mounted() {},
  computed: {
    ...mapGetters(["roomData", "userInfo", "accountData", "serTime"]),
  },
  methods: {
    hideBetOpBox: function () {
      this.showBetOpBox = false;
      this.showBetInfoBox = true;
    },
    checkOdds(index, title, value, type) {
      if (type != undefined) {
        index = type + "_" + index;
      }
      this.checkedOddIndex = index;
      var obj = {
        title,
        index,
        value,
        money: this.checkedMoney,
        realLen: 1,
      };
      if (!this.roomData.notZhuiHao) {
        this.checkedOdd = [obj];
        this.oddsWay = [obj];
      } else {
        if (
          JSON.stringify(this.checkedOdd).indexOf(JSON.stringify(obj)) == -1
        ) {
          this.checkedOdd.push(obj);
          this.oddsWay.push(obj);
        } else {
          for (var i = 0; i < this.checkedOdd.length; i++) {
            if (this.checkedOdd[i].index == index) {
              this.checkedOdd.splice(i, 1);
              this.oddsWay.splice(i, 1);
            }
          }
        }
      }
      this.realCkedOdd = this.checkedOdd;
      this.totalMoney = this.realCkedOdd.length * this.checkedMoney;
    },
    checkLhcOdds(index, title, value) {
      var str1 = title.split("_")[0];
      var str2 = title.split("_")[1];
      if (this.chekedMethod == 9) {
        str2 = str2.substr(0, 1);
      }
      var obj = {
        title,
        index,
        value,
        money: this.checkedMoney,
      };
      if (JSON.stringify(this.checkedOdd).indexOf(JSON.stringify(obj)) == -1) {
        if (!this.roomData.notZhuiHao) {
          if (this.realCkedOdd.length == 1) {
            this.$vux.toast.show({ text: "追号只能选择一注~" });
            return;
          }
        }
        if (this.chekedMethod == 3) {
          if (this.checkedOdd.length == 10) {
            this.$vux.toast.show({ text: "最多选择10个号码~" });
            return;
          }
        }
        if (this.chekedMethod == 8 || this.chekedMethod == 9) {
          if (this.checkedOdd.length == 8) {
            this.$vux.toast.show({ text: "最多选择8个号码~" });
            return;
          }
        }
        if (this.chekedMethod == 10) {
          if (this.chekedMethod1 == 0) {
            if (this.checkedOdd.length == 8) {
              this.$vux.toast.show({ text: "最多选择8个号码~" });
              return;
            }
          } else if (this.chekedMethod1 == 1) {
            if (this.checkedOdd.length == 9) {
              this.$vux.toast.show({ text: "最多选择9个号码~" });
              return;
            }
          } else if (this.chekedMethod1 == 2) {
            if (this.checkedOdd.length == 10) {
              this.$vux.toast.show({ text: "最多选择10个号码~" });
              return;
            }
          } else if (this.chekedMethod1 == 3) {
            if (this.checkedOdd.length == 11) {
              this.$vux.toast.show({ text: "最多选择11个号码~" });
              return;
            }
          } else if (this.chekedMethod1 == 4) {
            if (this.checkedOdd.length == 12) {
              this.$vux.toast.show({ text: "最多选择12个号码~" });
              return;
            }
          } else if (this.chekedMethod1 == 5) {
            if (this.checkedOdd.length == 13) {
              this.$vux.toast.show({ text: "最多选择13个号码~" });
              return;
            }
          }
        }
        this.lmTitleArr.push(str2);
        this.checkedOdd.push(obj);
        console.log(this.checkedOdd, "this.checkedOdd");
      } else {
        for (var i = 0; i < this.checkedOdd.length; i++) {
          if (this.checkedOdd[i].index == index) {
            this.checkedOdd.splice(i, 1);
            this.lmTitleArr.splice(i, 1);
          }
        }
      }
      var realZhuMany;
      if (this.chekedMethod == 3) {
        if (this.chekedMethod1 == 0 || this.chekedMethod1 == 1) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 3);
        } else {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 2);
        }
      }
      if (this.chekedMethod == 8 || this.chekedMethod == 9) {
        if (this.chekedMethod1 == 0 || this.chekedMethod1 == 3) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 2);
        } else if (this.chekedMethod1 == 1 || this.chekedMethod1 == 4) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 3);
        } else if (this.chekedMethod1 == 2 || this.chekedMethod1 == 5) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 4);
        }
      }
      if (this.chekedMethod == 10) {
        if (this.chekedMethod1 == 0) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 5);
        } else if (this.chekedMethod1 == 1) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 6);
        } else if (this.chekedMethod1 == 2) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 7);
        } else if (this.chekedMethod1 == 3) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 8);
        } else if (this.chekedMethod1 == 4) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 9);
        } else if (this.chekedMethod1 == 5) {
          realZhuMany = this.getRealZhu(this.checkedOdd.length, 10);
        }
      }
      this.realCkedOdd = [];
      for (var i = 0; i < realZhuMany; i++) {
        if (
          this.chekedMethod == 3 &&
          (this.chekedMethod1 == 0 || this.chekedMethod1 == 3)
        ) {
          this.realCkedOdd.push({
            title: str1 + "_" + this.lmTitleArr,
            index,
            money: this.checkedMoney,
            value: value.split("/")[1],
          });
          this.oddsWay[0] = {
            title: str1 + "_" + this.lmTitleArr,
            money: this.checkedMoney * realZhuMany,
            single_money: this.checkedMoney,
            realLen: realZhuMany,
            value: value.split("/")[1],
          };
        } else {
          this.realCkedOdd.push({
            title: str1 + "_" + this.lmTitleArr,
            index,
            money: this.checkedMoney,
            value,
          });
          this.oddsWay[0] = {
            title: str1 + "_" + this.lmTitleArr,
            money: this.checkedMoney * realZhuMany,
            single_money: this.checkedMoney,
            realLen: realZhuMany,
            value,
          };
        }
      }
      this.totalMoney = this.realCkedOdd.length * this.checkedMoney;
    },
    getRealZhu(a, b) {
      var topNum = 1;
      for (var i = a; i > a - b; i--) {
        topNum = topNum * i;
      }
      var botNum = 1;
      for (var j = 1; j <= b; j++) {
        botNum = botNum * j;
      }
      let dataSum = topNum / botNum;
      return dataSum;
    },
    setZhDlg: function () {
      var totalZhMoney = 0;
      var zhTableData = [];
      var zhBetData = [];
      var issue = this.roomData.issue;
      this.manyQi = Math.round(this.manyQi);
      this.manyBei = Math.round(this.manyBei);
      if (this.manyQi > 100) {
        this.$vux.alert.show({ content: "最多追加100期！" });
        this.manyQi = 100;
        return;
      }
      for (var i = 1; i <= this.manyQi; i++) {
        totalZhMoney += this.checkedMoney * Math.pow(this.manyBei, i - 1);
        zhTableData.push({
          issue: issue,
          money: this.checkedMoney * Math.pow(this.manyBei, i - 1) + "元宝",
          multiple: Math.pow(this.manyBei, i - 1) + "倍",
        });
        zhBetData.push({
          qihao: issue,
          money: this.checkedMoney * Math.pow(this.manyBei, i - 1),
          single_money: this.checkedMoney,
          way: this.oddsWay[0].title,
          multiple: Math.pow(this.manyBei, i - 1),
        });
        issue++;
      }
      this.zhuiHaoList = zhTableData;
      this.totalZhMoney = totalZhMoney;
      this.zhBetData = zhBetData;
      this.showZhList = true;
    },
    sendZhOdds: function () {
      var that = this;
      this.$vux.confirm.show({
        title: "提示",
        content:
          "本次追号" + that.manyQi + "期，共" + that.totalZhMoney + "元宝",
        onConfirm: function () {
          const agentData = {
            token: that.token,
            commandid: "3019",
            nickname: that.userInfo.nickname,
            data: that.zhBetData,
            win_stop: that.winStop ? 1 : 0,
            avatar: that.userInfo.avatar,
          };
          websocketsend(agentData);
          var obj = that.roomData;
          obj.showPmDlg = false;
          that.$store.commit("setRoomData", obj);
        },
      });
    },
    sendOdds: function () {
      if (this.roomData.stopBet) {
        this.$vux.alert.show({ content: "当前已封盘，不能投注" });
        return;
      }
      if (this.realCkedOdd.length < 1) {
        return;
      }
      var way = [];
      var money = [];
      var single_money = [];
      if (this.oddsWay.length > 0) {
        if (
          this.chekedMethod == 3 ||
          this.chekedMethod == 8 ||
          this.chekedMethod == 9 ||
          this.chekedMethod == 10
        ) {
          for (var i = 0; i < this.oddsWay.length; i++) {
            way.push(this.oddsWay[i].title);
          }
          money[0] = this.totalMoney;
          single_money = [this.checkedMoney];
        } else {
          for (var i = 0; i < this.oddsWay.length; i++) {
            way.push(this.oddsWay[i].title);
            money.push(this.checkedMoney);
          }
          single_money = money;
        }
      }
      const agentData = {
        token: this.token,
        commandid: "3006",
        nickname: this.userInfo.nickname,
        way: way,
        money: money,
        single_money: single_money,
        avatar: this.userInfo.avatar,
      };
      var uniNo = new Date().getTime() + Math.floor(Math.random() * 900) + 100;
      var params = {
        user_id: this.userInfo.id,
        lottery_type: this.$route.query.lottery_type,
        room_id: this.$route.query.id,
        nickname: this.userInfo.nickname,
        money: JSON.stringify(money),
        issue: this.roomData.issue,
        single_money: JSON.stringify(single_money),
        way: JSON.stringify(way),
        serTime: this.serTime,
        uniNo: uniNo,
      };
      let lotRstData = {
        isHttp: true,
        isLoading: true,
        avatar: this.userInfo.avatar,
        commandid: 30007,
        issue: this.roomData.issue,
        money: money,
        nickname: this.userInfo.nickname,
        time: timeFormat(new Date().getTime()),
        total_money: this.totalMoney,
        total_zushu: this.realCkedOdd.length,
        uid: this.userInfo.id,
        uniNo: uniNo,
        sort: this.userInfo.honor.sort,
        single_money: single_money,
        serTime: this.serTime,
        order_no: "",
        way: way,
        loadingFailed: false,
        failedText: "网络错误，请重试",
      };
      this.$store.commit("setLotRstData", lotRstData);
      this.$http
        .post(this.urlRequest + "?m=api&c=workerman&a=http_betting", params)
        .then(
          (result) => {
            if (result.commandid != 3007) {
              var failedObj = JSON.parse(JSON.stringify(lotRstData));
              failedObj.loadingFailed = true;
              failedObj.failedText = result.content;
              this.$store.commit("setNewRstData", failedObj);
              return;
            }
            var accountData = this.accountData;
            accountData.money_usable = result.current_money;
            this.$store.commit("setAccountData", accountData);
            this.$store.commit("setNewRstData", result);
          },
          (err) => {
            lotRstData.loadingFailed = true;
            lotRstData.failedText = "投注超时，请重新下注";
            this.$store.commit("setNewRstData", lotRstData);
          }
        );

      var obj = this.roomData;
      obj.showPmDlg = false;
      this.$store.commit("setRoomData", obj);
      this.changePlay(this.chekedMethod);
    },
    sendZdOdds: function () {
      if (this.zhuDanOdd.length < 1) {
        return;
      }
      if (this.roomData.stopBet) {
        this.$vux.alert.show({ content: "当前已封盘，不能投注" });
        return;
      }
      var that = this;
      var way = [];
      var money = [];
      var single_money = [];
      for (var i = 0; i < this.zhuDanOdd.length; i++) {
        way.push(this.zhuDanOdd[i].title);
        money.push(this.zhuDanOdd[i].money);
        if (_.isEmpty(this.zhuDanOdd[i].single_money)) {
          single_money.push(this.checkedMoney);
        } else {
          single_money.push(this.zhuDanOdd[i].single_money);
        }
      }
      this.$vux.confirm.show({
        title: "提示",
        content: "本次投注" + that.totalMoney1 + "元宝",
        onConfirm: () => {
          const agentData = {
            token: that.token,
            commandid: "3006",
            nickname: that.userInfo.nickname,
            way: way,
            money: money,
            single_money: single_money,
            avatar: that.userInfo.avatar,
          };
          var uniNo =
            new Date().getTime() + Math.floor(Math.random() * 900) + 100;
          var params = {
            user_id: this.userInfo.id,
            lottery_type: this.$route.query.lottery_type,
            room_id: this.$route.query.id,
            nickname: this.userInfo.nickname,
            money: JSON.stringify(money),
            issue: this.roomData.issue,
            single_money: JSON.stringify(single_money),
            way: JSON.stringify(way),
            serTime: this.serTime,
            uniNo: uniNo,
          };
          let lotRstData = {
            isHttp: true,
            isLoading: true,
            avatar: this.userInfo.avatar,
            commandid: 30007,
            issue: this.roomData.issue,
            money: money,
            nickname: this.userInfo.nickname,
            time: timeFormat(new Date().getTime()),
            total_money: this.totalMoney,
            total_zushu: this.realCkedOdd.length,
            single_money: single_money,
            uid: this.userInfo.id,
            uniNo: uniNo,
            sort: this.userInfo.honor.sort,
            serTime: this.serTime,
            order_no: "",
            way: way,
            loadingFailed: false,
            failedText: "网络错误，请重试",
          };
          this.$store.commit("setLotRstData", lotRstData);
          this.$http
            .post(this.urlRequest + "?m=api&c=workerman&a=http_betting", params)
            .then(
              (result) => {
                if (result.commandid != 3007) {
                  var failedObj = JSON.parse(JSON.stringify(lotRstData));
                  failedObj.loadingFailed = true;
                  failedObj.failedText = result.content;
                  this.$store.commit("setNewRstData", failedObj);
                  return;
                }
                var accountData = this.accountData;
                accountData.money_usable = result.current_money;
                this.$store.commit("setAccountData", accountData);
                this.$store.commit("setNewRstData", result);
              },
              (err) => {
                lotRstData.loadingFailed = true;
                lotRstData.failedText = "投注超时，请重新下注";
                this.$store.commit("setNewRstData", lotRstData);
              }
            );

          var obj = that.roomData;
          obj.showPmDlg = false;
          that.$store.commit("setRoomData", obj);
          that.checkedOdd = [];
          that.zhuDanOdd = [];
          that.zhuDanOddLen = 0;
          that.lmTitleArr = [];
          that.totalMoney1 = 0;
          that.realCkedOdd = [];
        },
      });
    },
    changeSltIdx: function (val) {
      this.resetOdds();
      this.activeSelect = val[0];
      for (var i = 0; i < this.wanfOdds[this.chekedMethod].set.length; i++) {
        if (this.wanfOdds[this.chekedMethod].set[i] == this.activeSelect) {
          this.playMethod = this.wanfOdds[this.chekedMethod].panel[i];
          this.chekedMethod1 = i;
        }
      }
    },
    addOddsList: function () {
      this.zhuDanOdd = this.zhuDanOdd.concat(this.oddsWay);
      if (
        this.chekedMethod == 3 ||
        this.chekedMethod == 8 ||
        this.chekedMethod == 9 ||
        this.chekedMethod == 10
      ) {
        this.zhuDanOddLen += this.oddsWay[0].realLen;
      } else {
        this.zhuDanOddLen += this.oddsWay.length;
      }
      console.log(this.zhuDanOdd, "zhuDanOdd");
      this.oddsWay = [];
      this.checkedOdd = [];
      this.oddsWay = [];
      this.lmTitleArr = [];
      this.checkedOddIndex = -1;
      this.showBetInfoList = false;
      this.showBetOpBox = false;
      this.showBetInfoBox = true;
    },
    clearBetList: function () {
      var that = this;
      this.$vux.confirm.show({
        title: "提示",
        content: "是否清空当前注单？",
        onConfirm: function () {
          that.zhuDanOdd = [];
          that.zhuDanOddLen = 0;
        },
      });
    },
    removeBetItem: function (index) {
      this.zhuDanOddLen -= this.zhuDanOdd[index].realLen;
      this.zhuDanOdd.splice(index, 1);
    },
    setMinMoney: function () {
      this.checkedMoney = this.roomData.minBetMoney;
      this.checkedMoneyIdx = -1;
    },
    checkedOddsStyle: function (index, type) {
      if (type != undefined) {
        index = type + "_" + index;
      }
      if (!this.roomData.notZhuiHao) {
        if (
          this.chekedMethod == 3 ||
          this.chekedMethod == 8 ||
          this.chekedMethod == 9 ||
          this.chekedMethod == 10
        ) {
          for (var i = 0; i < this.checkedOdd.length; i++) {
            if (
              this.checkedOdd[i].index == index &&
              this.realCkedOdd.length <= 1
            ) {
              return true;
            }
          }
        } else if (this.checkedOddIndex == index) {
          return true;
        }
      } else {
        for (var i = 0; i < this.checkedOdd.length; i++) {
          if (this.checkedOdd[i].index == index) {
            return true;
          }
        }
      }
    },
    checkMoney: function (index, item) {
      if (item == "梭哈") {
        let accountData = this.accountData.money_usable;
        this.checkedMoney = Math.round(Number(accountData));
        this.checkedMoneyIdx = index;
        this.totalMoney = this.checkedMoney * this.checkedOdd.length;
      } else {
        this.checkedMoney = item;
        this.checkedMoneyIdx = index;
      }
      for (var i = 0; i < this.checkedOdd.length; i++) {
        if (this.checkedOdd[i].index == this.checkedOddIndex) {
          this.checkedOdd[i].money = this.checkedMoney;
        }
      }
    },
    changePlay(id) {
      this.chekedMethod = id;
      this.resetOdds();
      if (_.isArray(this.wanfOdds[id].set)) {
        this.activeSelect = this.wanfOdds[id].set[0];
      }

      if (id == 11 || id == 12 || id == 13) {
        this.playMethod = this.wanfOdds[id].panel;
        return;
      }
      this.playMethod = this.wanfOdds[id].panel[0];
    },
    resetOdds() {
      this.oddsWay = [];
      this.realCkedOdd = [];
      this.checkedOddIndex = -1;
      this.showZhBox = false;
      this.checkedOdd = [];
      this.chekedMethod1 = [];
      this.lmTitleArr = [];
    },
    showZhBoxMask() {
      this.checkedOdd = [];
      this.checkedOddIndex = -1;
      this.oddsWay = [];
      this.showZhBox = false;
    },
  },
  components: {
    CheckIcon,
  },
  watch: {
    // 获取赔率数据后，处理
    oddsData: function (newVal, oldVal) {
      let that = this;
      if (!_.isEmpty(newVal)) {
        for (var i = 0; i < that.wanfOdds.length; i++) {
          if (!_.isEmpty(newVal.panel_1) && that.wanfOdds[i].name == "特码") {
            that.wanfOdds[i].panel = newVal.panel_1;
          } else if (
            !_.isEmpty(newVal.panel_2) &&
            that.wanfOdds[i].name == "正码"
          ) {
            that.wanfOdds[i].panel = newVal.panel_2;
          } else if (
            !_.isEmpty(newVal.panel_3) &&
            that.wanfOdds[i].name == "正特"
          ) {
            that.wanfOdds[i].panel = newVal.panel_3;
          } else if (
            !_.isEmpty(newVal.panel_4) &&
            that.wanfOdds[i].name == "连码"
          ) {
            that.wanfOdds[i].panel = newVal.panel_4;
          } else if (
            !_.isEmpty(newVal.panel_5) &&
            that.wanfOdds[i].name == "半波"
          ) {
            that.wanfOdds[i].panel = newVal.panel_5;
          } else if (
            !_.isEmpty(newVal.panel_6) &&
            that.wanfOdds[i].name == "尾数"
          ) {
            that.wanfOdds[i].panel = newVal.panel_6;
          } else if (
            !_.isEmpty(newVal.panel_7) &&
            that.wanfOdds[i].name == "一肖"
          ) {
            that.wanfOdds[i].panel = newVal.panel_7;
          } else if (
            !_.isEmpty(newVal.panel_8) &&
            that.wanfOdds[i].name == "特肖"
          ) {
            that.wanfOdds[i].panel = newVal.panel_8;
          } else if (
            !_.isEmpty(newVal.panel_9) &&
            that.wanfOdds[i].name == "连肖"
          ) {
            that.wanfOdds[i].panel = newVal.panel_9;
          } else if (
            !_.isEmpty(newVal.panel_10) &&
            that.wanfOdds[i].name == "连尾"
          ) {
            that.wanfOdds[i].panel = newVal.panel_10;
          } else if (
            !_.isEmpty(newVal.panel_11) &&
            that.wanfOdds[i].name == "不中"
          ) {
            that.wanfOdds[i].panel = newVal.panel_11;
          } else if (
            !_.isEmpty(newVal.panel_12) &&
            that.wanfOdds[i].name == "正码1-6"
          ) {
            that.wanfOdds[i].panel = newVal.panel_12;
          } else if (
            !_.isEmpty(newVal.panel_13) &&
            that.wanfOdds[i].name == "正1-6龙虎"
          ) {
            that.wanfOdds[i].panel = newVal.panel_13;
          }
          if (_.isEmpty(that.wanfOdds[i].panel)) {
            that.wanfOdds.splice(i, 1);
            i--;
          }
        }
      }
      this.playMethod = that.wanfOdds[0].panel[0];
    },
    lDragonData: function (newVal, oldVal) {
      if (newVal) {
        for (var i = 0; i < this.wanfOdds.length; i++) {
          if (this.wanfOdds[i].name == "长龙投注") {
            this.wanfOdds.splice(i, 1);
          }
        }
        if (newVal.length > 0) {
          this.wanfOdds.push({
            key: "长龙投注",
            name: "长龙投注",
            panel: newVal,
          });
          if (this.wanfOdds[this.chekedMethod].name == "长龙投注") {
            this.playMethod = newVal;
          }
        }
      }
    },
    checkedOddIndex: function (newVal) {},
    betMoneyList: function (newVal) {
      this.checkedMoney = this.betMoneyList[0];
    },
    realCkedOdd: function (newVal) {
      var yqMoneyArr = [];
      for (var i = 0; i < newVal.length; i++) {
        yqMoneyArr.push((newVal[i].value * newVal[i].money).toFixed(0));
      }
      this.maxyqMoney = Math.max.apply(null, yqMoneyArr);
      this.minyqMoney = Math.min.apply(null, yqMoneyArr);

      if (this.roomData.notZhuiHao) {
        if (newVal.length > 0) {
          this.showBetOpBox = true;
          this.showBetInfoBox = false;
        } else {
          this.showBetInfoBox = true;
          this.showBetOpBox = false;
          this.minyqMoney = 0;
        }
      } else {
        if (newVal.length > 0) {
          this.showZhBox = true;
        } else {
          this.showZhBox = false;
        }
      }
    },
    zhuDanOdd: function (newVal, oldVal) {
      var yqMoneyArr = [];
      this.totalMoney1 = 0;
      if (newVal.length > 0) {
        for (var i = 0; i < newVal.length; i++) {
          this.totalMoney1 += parseInt(newVal[i].money);
          yqMoneyArr.push((newVal[i].money * newVal[i].value).toFixed(0));
        }
        this.maxyqMoney = Math.max.apply(null, yqMoneyArr);
        this.minyqMoney = Math.min.apply(null, yqMoneyArr);
      } else {
        this.maxyqMoney = 0;
        this.minyqMoney = 0;
      }
    },
    checkedMoney: function (newVal) {
      var yqMoneyArr = [];
      this.totalMoney = newVal * this.realCkedOdd.length;
      if (this.realCkedOdd.length > 0) {
        for (var i = 0; i < this.realCkedOdd.length; i++) {
          this.realCkedOdd[i].money = newVal;
          yqMoneyArr.push(
            (this.realCkedOdd[i].money * this.realCkedOdd[i].value).toFixed(0)
          );
        }
        this.maxyqMoney = Math.max.apply(null, yqMoneyArr);
        this.minyqMoney = Math.min.apply(null, yqMoneyArr);
      }
    },
    roomData: {
      handler: function (newVal, oldVal) {
        if (!newVal.showPmDlg) {
          this.showZhBox = false;
          this.showBetOpBox = false;
          this.showBetInfoBox = false;
          this.showZhList = false;
          this.zhuiHaoList = [];
          this.checkedOddIndex = -1;
        }
        if (!newVal.notZhuiHao) {
          this.resetOdds();
          this.showBetOpBox = false;
          this.showBetInfoBox = false;
        }
      },
      deep: true,
    },
  },
  deactivated() {},
  beforeDestroy() {},
};

// WEBPACK FOOTER //
// ./src/components/room/playMethods/lhc/lhc.vue
